import { getDatabaseObjectTypeEnumSchema } from '@/enums/databaseObjectTypeEnum';
import { AdColumn } from '@/components/AdTable';
import { useI18n } from '@/hooks/web/useI18n';

const { t } = useI18n();
const databaseObjectTypeEnumSchema = getDatabaseObjectTypeEnumSchema();

export const columns: AdColumn[] = [
  {
    title: t('entity.idTitle'),
    dataIndex: 'Id',
    width: 180,
    ifShow: false,
    defaultHidden: true,
    formVisible: true,
    formEditable: false,
    filterable: false,
    dataType: 'integer',
  },
  {
    title: t('routes.system.authorization.entityInfo.nameTitle'),
    dataIndex: 'Name',
    width: 200,
    formVisible: true,
    formEditable: false,
    required: true,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('routes.system.authorization.entityInfo.typeNameTitle'),
    dataIndex: 'TypeName',
    width: 500,
    formVisible: false,
    formEditable: false,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('routes.system.authorization.entityInfo.dbSchemaTitle'),
    dataIndex: 'DbSchema',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('routes.system.authorization.entityInfo.dbObjNameTitle'),
    dataIndex: 'DbObjName',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('routes.system.authorization.entityInfo.dbObjTypeTitle'),
    dataIndex: 'DbObjType',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'enum',
    enumData: databaseObjectTypeEnumSchema,
  },
  {
    title: t('routes.system.authorization.entityInfo.auditEnabledTitle'),
    dataIndex: 'AuditEnabled',
    width: 100,
    formVisible: true,
    formEditable: true,
    filterable: true,
    dataType: 'boolean',
  },
  {
    title: t('routes.system.authorization.entityInfo.eventEnabledTitle'),
    dataIndex: 'EventEnabled',
    width: 100,
    formVisible: true,
    formEditable: true,
    filterable: true,
    dataType: 'boolean',
    formCustomer: {
      colProps: {
        // span: 12,
        xs: 24, // <576px
        sm: 24, // ≥576px
        md: 12, // ≥768px
        lg: 12, // ≥992px
        xl: 12, // ≥1200px
        xxl: 6, // ≥1600px
        // xxxl: 6, // ≥2000px 3.0
      },
    },
  },
  {
    title: t('entity.creationAudited.createdTimeTitle'),
    dataIndex: 'CreatedTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('entity.updateAudited.updatedTimeTitle'),
    dataIndex: 'UpdatedTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('entity.dataVersion.dataVersionTitle'),
    dataIndex: 'DataVersion',
    width: 200,
    formVisible: true,
    formEditable: false,
    filterable: false,
    dataType: 'integer',
  },
];
